<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>当前站点首页生成</title>
	<%@ include file="/common/meta.jsp"%>
	<%@ include file="/common/common.jsp"%>
	<script type="text/javascript" src="${ctx}/js/jquery.progressbar2.js"></script>
	<script type="text/javascript" src="${ctx}/js/publish.js"></script>
</head>
<body>
<s:set name="siteId" value="#session['CURRENT_SITE'].siteId"></s:set>
	<form name="publish_form">
	<s:hidden name="site.siteId"/>
	<s:hidden name="percentKey"/>
<div id="wrapper">
	<div class="curmb"><div class="curmb_css">您现在的位置：<a href="${ctx}/main.action">首页</a><span>></span><a href="#">发布管理</a></div></div>
	<div class="listtit" id="listtit"><p><span><strong>发布</strong><s:if test="site!=null">--当前站点--<font color="red"><s:property value="site.siteName"/></font></s:if></span></p></div>
	<div class="listoperate whitebg" id="listoperate">
		<span class="space20"></span>
			<a href="#" class="alinks" onclick="publishAll()">全站</a>|
			<a href="#" class="alinks" onclick="publishCat()">栏目</a>|
			<a href="#" class="alinkscurrent" onclick="publishTopic()">专题</a>|
			<a href="#" class="alinks" onclick="publishSurvery()">调查</a>|
			<a href="#" class="alinks" onclick="publishAssociator()">协会理事会</a>
	</div>
	<div class="issuecheck">
		<s:if test="%{authLicence('2_2_6',#siteId)}">
			<input type="radio" name="website" checked="checked" value="all" /><label>全量</label>
			<input type="radio" name="website" value="more"/><label>增量</label>
			<input type="radio" name="website" value="index"/><label>只发布首页、列表页</label>
			<!-- <input type="radio" name="website" value="list"/><label>只发列表页面</label> -->
		</s:if>
		<s:elseif test="%{authLicenceLike('4_4_2')}">
			<input type="radio" name="website" checked="checked" value="all" /><label>全量</label>
			<input type="radio" name="website" value="more"/><label>增量</label>
			<input type="radio" name="website" value="index"/><label>只发布首页、列表页</label>
			<!-- <input type="radio" name="website" value="list"/><label>只发列表页面</label> -->
		</s:elseif>
		<s:else>
			<input type="radio" name="website" value="all" disabled="disabled"/><label>全量</label>
			<input type="radio" name="website" value="more" disabled="disabled"/><label>增量</label>
			<input type="radio" name="website" value="index" disabled="disabled"/><label>只发布首页、列表页</label>
			<!-- <input type="radio" name="website" value="list" disabled="disabled"/><label>只发列表页面</label> -->
		</s:else>
	</div>
	<div class="listoperate">
		<span>
		<s:if test="%{authLicence('2_2_6',#siteId)}">
			<input type="button" value="全选"  class="btnlist2"/>
			<input type="button" value="反选"  class="btnlist2" />
			<input type="button" value="发布" class="btnsave2" id="publish"/>
		</s:if>
		<s:elseif test="%{authLicenceLike('4_4_2')}">
			<input type="button" value="全选"  class="btnlist2"/>
			<input type="button" value="反选"  class="btnlist2" />
			<input type="button" value="发布" class="btnsave2" id="publish"/>
		</s:elseif>
		<s:else>
			<input type="button" value="全选"  class="btnlist2" disabled="disabled"/>
			<input type="button" value="反选"  class="btnlist2" disabled="disabled"/>
			<input type="button" value="发布" class="btnsave2" id="publish" disabled="disabled"/>
		</s:else>
		</span>
	</div>
	<div class="listbox" id="listbox">
		<form name="tableList">
		<table class="listgrid" id="listtable">
			<tbody>
				<tr>
					<th><input type="checkbox" name="totalCheck0" id="totalCheck"/></th>
					<th>专题名称</th>
					<th>截止时间</th>
					<th>创建时间</th>
					<th>修改人</th>
					<th>审核人</th>
					<th>操作</th>
				</tr>
				<s:iterator value="topicPage.result">
				<tr>
					<td><input type="checkbox" value="checkbox1" name="checkbox" id="<s:property value="topicId"/>"/></td>
					<td><s:property value="topicName"/></td>
					<td><s:property value="endTime"/></td>
					<td><s:property value="createTime"/></td>
					<td><s:property value="updateLoginName"/></td>
					<td><s:property value="auditLoginName"/></td>
					<td>
					<s:if test="%{authLicence('2_2_6',#siteId)}">
						<a href="#" onclick="goPublish('<s:property value="topicId"/>')">发布</a>
					</s:if>
					<s:else>
						发布
					</s:else>
					</td>
				</tr>
				</s:iterator>
			</tbody>
		</table>
		</form>
	</div>
	<div class="listoperateb ">
		<span>
			<s:if test="%{authLicence('2_2_6',#siteId)}">
			<input type="button" value="全选"  class="btnlist2"/>
			<input type="button" value="反选"  class="btnlist2" />
			<input type="button" value="发布" class="btnsave2" id="publish"/>
		</s:if>
		<s:elseif test="%{authLicenceLike('4_4_2')}">
			<input type="button" value="全选"  class="btnlist2"/>
			<input type="button" value="反选"  class="btnlist2" />
			<input type="button" value="发布" class="btnsave2" id="publish"/>
		</s:elseif>
		<s:else>
			<input type="button" value="全选"  class="btnlist2" disabled="disabled"/>
			<input type="button" value="反选"  class="btnlist2" disabled="disabled"/>
			<input type="button" value="发布" class="btnsave2" id="publish" disabled="disabled"/>
		</s:else>
		</span>
	</div>
</div>
</form>
<div id="lightbox_c" class="lightbox" >
	<div class="lighttit"><p><span><input type="button" value="&nbsp;" id="lightclose_c" class="lightclose" /><strong>发布站点</strong></span></p></div>
	<div class="lightmain">
		<div class="lightmaintit"><input type="button" value="错误信息" id="changeInfo" class="btnlist2"/><label id="returnInfo">正在发布专题....</label>
		</div>
		<div id="progressBar_bg">
			<span class="progressBar" id="pb2"></span>
			<span id="progressBar_bh"></span>
		</div>
		<div align="right"><input type="button" value="隐藏日志" id="hideInfo" class="btnlist2"/>
		</div>
		<div id="publishInfoAll" align="center">
			<textarea rows="10" cols=60 id="pia" readonly="readonly">aaa</textarea>
		</div>
		<div id="publishInfoError" align="center">
			<textarea rows="10" cols=60 id="pie" readonly="readonly">bbb</textarea>
		</div>
		<div class="lightbtnbox mb25"><input type="button" value="确认" id="lightsubmit_c" class="btnlist2"/><input type="button" value="停止" id="stoppublish" class="btnlist2 ml20"/></div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	var ctx = '${ctx}';
	$("#hideInfo").click(function(){
		if($(this).val()=="隐藏日志"){
			$(this).val("显示日志");
			$("#publishInfoAll").hide();
			$("#publishInfoError").hide();
		}else{
			$(this).val("隐藏日志");
			$("#publishInfoAll").show();
			$("#publishInfoError").hide();
		}
	});
	$("#changeInfo").click(function(){
		if($(this).val()=="错误信息"){
			$(this).val("全部信息");
			$("#hideInfo").val("隐藏日志");
			$("#publishInfoAll").hide();
			$("#publishInfoError").show();
		}else{
			$(this).val("错误信息");
			$("#hideInfo").val("隐藏日志");
			$("#publishInfoAll").show();
			$("#publishInfoError").hide();
		}
	});
	$("#stoppublish").click(function(){
		stopPublish();
	});
	$("#publish").click(function(){
		var topicIds = '';
		$("input[name=checkbox]").each(function(){
			topicIds+=$(this).attr("id")+",";
		});
		if(topicIds==""){
			alert("请选择专题！");
			return false;
		}
		$("#stoppublish").attr("disabled","");
		$$.shade("#publish","#lightclose_c,#lightsubmit_c","#lightbox_c","350");
		publishTopics(topicIds,$("input[name=website]:checked").val());
	});
	function goPublish(topicId){
		$$.shade("#publish","#lightclose_c,#lightsubmit_c","#lightbox_c","300");
		publishTopics(topicId,$("input[name=website]:checked").val());
	}
	$("#lightclose_c").click(function(){
		initBar();
	});
	$("#lightsubmit_c").click(function(){
		initBar();
	});
	function initBar(){
		$('#pb2').progressBar(0);
	}
	$(document).ready(function (){
		$("#after").hide();
		$("#publish_index").hide();
		$("#publish_more").hide();
		$("#pb2").progressBar({ barImage: '../images/progressbg_yellow2.gif'} );
	});
	function publishAll(){
		$("form[name=publish_form]").attr("action","${ctx}/generate/list-site.action");
		$("form[name=publish_form]").submit();
	}
	function publishCat(){
		$("form[name=publish_form]").attr("action","${ctx}/generate/list-cat.action");
		$("form[name=publish_form]").submit();
	}
	function publishTopic(){
		$("form[name=publish_form]").attr("action","${ctx}/generate/list-topic.action");
		$("form[name=publish_form]").submit();
	}
	function publishSurvery(){
		$("form[name=publish_form]").attr("action","${ctx}/generate/list-survey.action");
		$("form[name=publish_form]").submit();
	}
	function publishAssociator(){
		$("form[name=publish_form]").attr("action","${ctx}/generate/list-associator.action");
		$("form[name=publish_form]").submit();
	}
</script>